package com.consumer.kafka.starter.service;

import com.consumer.kafka.starter.core.KafkaMessage;
import com.consumer.kafka.starter.core.KafkaRequest;
import org.springframework.kafka.KafkaException;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.ListenableFuture;

/**
 * 封装kafka基础方法
 *
 * @author: xinyue
 * @date: 2021/6/11 14:17
 */
public interface IKafkaService<K, V> {

    /**
     * 接收Kafka请求
     * @param request   请求
     * @return
     * @throws KafkaException
     */
    ListenableFuture<SendResult<K, V>> handle(KafkaRequest<K, V> request) throws KafkaException;

}
